import time
from concurrent.futures import ThreadPoolExecutor

executor = ThreadPoolExecutor(5)

def longtime(s):
    time.sleep(s)
    print(f'sleep {s} second')

for i in range(10):
    executor.submit(longtime, i)
    print(i)